using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CollegeShop.Infrastructure.Entities.Repository;

namespace CollegeShop.Infrastructure.Entities.Entity
{
    public class Salesunit : IAccessible<T_Salesunit, Salesunit>, ILogicEntity<T_Salesunit, Salesunit>
    {
        public int ID { get; set; }

        public string SalesUnitName { get; set; }

        public string SalesUnitNamePY { get; set; }

        public string LinkMan { get; set; }

        public string LinkPhone { get; set; }

        #region Extend
        public List<Dormitory> Dormitories { get; set; }
        #endregion

        protected override void Covariant(T_Salesunit model)
        {
            if (model != null)
            {
                    this.ID = model.ID;
                    this.SalesUnitName = model.SalesUnitName;
                    this.SalesUnitNamePY = model.SalesUnitNamePY;
                    this.LinkMan = model.LinkMan;
                    this.LinkPhone = model.LinkPhone;
            }
}
        protected override T_Salesunit Inverter(Salesunit model)
        {
            if (model != null)
            {
                return new T_Salesunit()
                {
                    ID = model.ID,
                    SalesUnitName = model.SalesUnitName,
                    SalesUnitNamePY = model.SalesUnitNamePY,
                    LinkMan = model.LinkMan,
                    LinkPhone = model.LinkPhone,
                };
            }
            return null;
        }
        public Salesunit Set(T_Salesunit dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
